<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>本年中本月比上一月增量图</title>
</head>
<div id="img" style="height:600px"></div>
<script src="echarts.js"></script>
<script>
    window.onload = function () {
        option = {
            xAxis: {
                type: 'category',
                data: ['1月', '2月', '3月', '4月','5月','6月','7月','8月','9月','10月','11月','12月']
            },
            legend: {
                data: ['2020', '2019', '2018', '2017', '2016']
            },
            name: {
                textStyle: {
                    color: '#fff',
                    backgroundColor: '#999',
                    borderRadius: 3,
                    padding: [3, 5]
                }
            },

            yAxis: {
                type: 'value'
            },
            series: [{
                data: [0.56,0.11 ,0.33
                    ,0.09
                    ,0.76
                    ,0.25
                    ,(-0.03)
                    ,(-0.71)
                    ,(-1.95)
                    ,0.5
                    ,1.37
                    ,1.16],
                type: 'line',
                name:'2020',
                itemStyle : { normal: {label : {show: true}}}
            },
                {
                    name: '2019',
                    type: 'line',
                    stack: '总量',
                    itemStyle : { normal: {label : {show: true}}},
                    data: [+0.03
                        ,-1.03
                        , -0.49
                        ,-0.01
                        ,-0.15
                        ,0.83
                        , 0.44
                        ,-0.08
                        ,-0.01
                        ,-1.02
                        ,1.85
                        ,1.67
                    ]
                },
                {
                    data: [0.27, 0.78,
                        0.68
                        , 0.13
                        , 1.31
                        , 2.23
                        , 5.52
                        , 0.56
                        , 8.52
                        , 0.13
                        , 2.5
                        , 1.22
                    ],
                    type: 'line',
                    name:'2018',
                    itemStyle : { normal: {label : {show: true}}}
                },
                {
                    name: '2017',
                    type: 'line',
                    stack: '总量',
                    itemStyle : { normal: {label : {show: true}}},
                    data: [
                        5.97
                        ,0.16
                        ,0.95
                        ,2.1
                        ,0.05
                        ,5.64
                        ,0.09
                        ,4.14
                        , 0.4
                        ,0.27
                        ,0.67
                    ]
                },
                {
                    name: '2016',
                    type: 'line',
                    stack: '总量',
                    itemStyle : { normal: {label : {show: true}}},
                    data: [2.47
                        ,-0.35
                        ,1.16
                        , 0.36
                        , -0.46
                        ,-0.72
                        , -1.34
                        , -0.85
                        ,-0.56
                        ,-0.11
                        , 1.55
                        , -1.21
                    ]
                }

            ],

        };
        //获取dom容器
        var myChart = echarts.init(document.getElementById('img'));
        // 使用刚指定的配置项和数据显示图表。
        myChart.setOption(option);

    }
</script>
<body>

</body>
</html>